Skip to content

Fix Garbage Characters in Resume Parser#8274

Open
pisum-sativum wants to merge 15 commits into
JhaSourav07:mainfrom
pisum-sativum:fix-resume-parser-garbage-chars
Open

Fix Garbage Characters in Resume Parser#8274
pisum-sativum wants to merge 15 commits into
JhaSourav07:mainfrom
pisum-sativum:fix-resume-parser-garbage-chars

Conversation

@pisum-sativum

Copy link
Copy Markdown
Contributor

Description

Fixes #6096

This PR resolves an issue with the resume parsing engine where valid UTF-8 characters were aggressively stripped out while misencoded garbage characters and decoding artifacts (such as é, \uFFFD) polluted the extracted text.

Key changes include:

  • Replaced the overly restrictive ASCII-only regex with one that safely preserves valid UTF-8, formatting marks, and bullet points.
  • Fixed a bug where failed parsing of binary documents (PDF/DOCX) improperly fell back to decoding raw bytes as UTF-8, causing massive artifact output.
  • Introduced a heuristic that cleanly repairs common misencoded UTF-8 artifacts resulting from document processor font-lookup issues without disrupting valid characters.

Pillar

  • 🎨 Pillar 1 — New Theme Design
  • 📐 Pillar 2 — Geometric SVG Improvement
  • 🕐 Pillar 3 — Timezone Logic Optimization
  • 🛠️ Other (Bug fix, refactoring, docs)

Visual Preview

(Not applicable as this is a backend parser fix, but the dashboard preview will no longer contain garbage formatting artifacts.)

Checklist before requesting a review:

  • I have read the CONTRIBUTING.md file.
  • I have tested these changes locally (localhost:3000/api/streak?user=YOUR_USERNAME).
  • I have run npm run format and npm run lint locally and resolved all errors (CI will fail otherwise).
  • My commits follow the Conventional Commits format (e.g., feat(themes): ..., fix(calculate): ...).
  • I have updated README.md if I added a new theme or URL parameter.
  • I have started the repo.
  • I have made sure that i have only one commit to merge in this PR.
  • The SVG output matches the CommitPulse "premium quality" aesthetic standard (no raw elements, smooth animations, correct fonts).
  • (Recommended) I joined the CommitPulse Discord community for contributor discussions, mentorship, and faster PR support.

Copilot AI review requested due to automatic review settings July 22, 2026 17:39
@vercel

vercel Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

@pisum-sativum is attempting to deploy a commit to the jhasourav07's projects Team on Vercel.

A member of the Team first needs to authorize it.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@retenta-bot

retenta-bot Bot commented Jul 22, 2026

Copy link
Copy Markdown

This pull request resolves a critical issue with the resume parser by enhancing its ability to handle UTF-8 characters and removing unwanted artifacts. This aligns with our previous decisions on bug fixes aimed at improving code quality, such as the recent fix for dead code in the calculateStreak function. Thank you for your contribution, and I look forward to your updates!

@retenta-bot retenta-bot Bot changed the title Fix resume parser garbage chars Fix Garbage Characters in Resume Parser Jul 22, 2026
@pisum-sativum

Copy link
Copy Markdown
Contributor Author

@JhaSourav07 I have done the necessary changes kindly check and merge with appropriate labels.

@github-actions github-actions Bot added the status:blocked This PR is blocked due to a failing CI check. label Jul 22, 2026
…owing them

Moves buffer header checks outside try/catch blocks so that failures in buffer.toString (e.g. in tests mocking the method) correctly propagate to callers. Only third-party parser failures (pdf-parse, mammoth) are silently caught. Fixes the failing error-resilience test.
@github-actions github-actions Bot removed the status:blocked This PR is blocked due to a failing CI check. label Jul 22, 2026
@github-actions

Copy link
Copy Markdown
Contributor

📦 Next.js Bundle Size Report (Gzipped Sizes)

✨ No significant bundle size changes detected.

📊 Summary of Totals

Category PR Size Base Size Difference
Total JS 3984.87 KB 3984.83 KB +0.04 KB (+0.00%)
Total CSS 331.41 KB 331.41 KB 0 B

@Aamod007 Aamod007 added level:intermediate Moderate complexity tasks type:bug Something isn't working as expected mentor:Aamod007 labels Jul 23, 2026

@Aamod007 Aamod007 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing the resume parser encoding issue! Handling Latin-1 character mangling is a tricky bug, and the fallback parsing logic looks solid.

However, it looks like this PR accidentally includes some unrelated changes. You have modified files like \lib/github.ts, \services/github/ci-analytics.ts, and \�pp/generator/data/socials.ts, which don't seem related to the resume parsing fix.

Please revert the changes to those files so that the PR focuses solely on \lib/resume-parser.ts.

Looking forward to getting this merged once the branch is cleaned up!

Label Justification:

  • \level:intermediate: Debugging and writing fixes for encoding issues and buffer parsing is an intermediate task.
  • \ ype:bug: Fixes broken character rendering when parsing CV files.
  • \mentor:Aamod007: Assigned as required.

@github-actions github-actions Bot added the status:blocked This PR is blocked due to a failing CI check. label Jul 23, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🚨 Hey @pisum-sativum, the CI Pipeline is failing on this PR and it has been marked as status:blocked.

Please fix the issues before this can be reviewed. Here's how:

1. Run checks locally before pushing:

npm run format:check   # Check Prettier formatting
npm run lint           # Run ESLint
npm run typecheck      # TypeScript type check
npm run test           # Run unit tests (Vitest)
npm run build          # Verify production build passes

2. Auto-fix common issues:

npm run format         # Auto-fix formatting with Prettier
npm run lint -- --fix  # Auto-fix lint errors where possible

3. Check the full failure log here:
👉 View CI Run

Once you push a fix and the CI passes, the status:blocked label will be removed automatically. 💪

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

level:intermediate Moderate complexity tasks mentor:Aamod007 status:blocked This PR is blocked due to a failing CI check. type:bug Something isn't working as expected

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Resume parser extracts irrelevant/garbage characters during file upload

3 participants